function $ajax(options) {
    var xhr = new XMLHttpRequest();
    if (options.type == 'GET') {
        xhr.open('get', options.url + "?" + options.data);
        xhr.send();
    }
    if (options.type == 'POST') {
        xhr.open('post', options.url)
        xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
        xhr.send(options.data);
    }

    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
            options.callback(xhr.responseText);
        }
    }
}
